Skip to content

riscv64: Add SIMD avg_round#6599

Merged
afonso360 merged 1 commit into
bytecodealliance:mainfrom
afonso360:riscv-simd-avg-round
Jun 17, 2023
Merged

riscv64: Add SIMD avg_round#6599
afonso360 merged 1 commit into
bytecodealliance:mainfrom
afonso360:riscv-simd-avg-round

Conversation

@afonso360
Copy link
Copy Markdown
Contributor

👋 Hey,

This PR implements the SIMD avg_round instruction. We don't have a native version of this, so we break it down into multiple ops, using a slightly modified formula from Hacker's Delight.

The original formula does a floor average round, but we correct that by using a special shift right instruction that rounds up the result. I think this is correct, but would appreciate a double check on it.

This passes both the cranelift tests, as well as the wasmtime *_arith2 test suites, however we can't enable them yet because they also require iabs which is only implemented in #6598.

@afonso360 afonso360 added the cranelift:area:riscv64 Issues related to the RISC-V 64 backend. label Jun 17, 2023
@afonso360 afonso360 requested a review from a team as a code owner June 17, 2023 12:01
@afonso360 afonso360 requested review from abrown and removed request for a team June 17, 2023 12:01
@github-actions github-actions Bot added the cranelift Issues related to the Cranelift code generator label Jun 17, 2023
Copy link
Copy Markdown
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@afonso360 afonso360 added this pull request to the merge queue Jun 17, 2023
Merged via the queue into bytecodealliance:main with commit 728d0f5 Jun 17, 2023
@afonso360 afonso360 deleted the riscv-simd-avg-round branch June 17, 2023 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cranelift:area:riscv64 Issues related to the RISC-V 64 backend. cranelift Issues related to the Cranelift code generator

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants